﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PA3PC113
{
   public class Cur_bs_shift
    {
       public string GetShiftNow()
       {
           DateTime date = DateTime.Now;//当前时间
           string shift = string.Empty;//班次
           string datenow = DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo);//当前时间yyyy-MM-dd
           string dateshift = DateTime.Now.ToString("yyyyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo);//当前时间yyyyMMdd

           if (date >= DateTime.Parse("" + datenow + " 07:30:00") && date < DateTime.Parse("" + datenow + " 15:30:00"))
           {
               return "1";//早
           }
           if (date >= DateTime.Parse("" + datenow + " 15:30:00") && date < DateTime.Parse("" + datenow + " 23:30:00"))
           {
               return "2";//中
           }
           if (date >= DateTime.Parse("" + datenow + " 23:30:00") && date <= DateTime.Parse("" + datenow + " 23:59:59"))
           {
               return "3";//晚
           }
           if (date >= DateTime.Parse("" + datenow + " 00:00:00") && date < DateTime.Parse("" + datenow + " 07:30:00"))
           {
               dateshift = DateTime.Now.AddDays(-1).ToString("yyyyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo);
               return "3";//晚
           }
           return shift;
       }
    }
}
